﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dao;
using Oracle.DataAccess.Client;
using Utils;

namespace BO
{
    public class OracleBo : BaseBO
    {
        /// <summary>
        /// 判断连接是否成功
        /// </summary>
        /// <returns></returns>
        public bool Contect()
        {
            string ConnectionString =OracleHelper.ConnectionString;
           OracleConnection connection = new OracleConnection(ConnectionString);
            try
            {
                connection.Open();
                if (connection.State == ConnectionState.Open)
                {
                    return true;
                }
                else
                {
                    MessageBox.Show(new NativeWindow(), "连接失败", "连接提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(new NativeWindow(), "连接失败:" + ex.Message, "连接提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }

        }
        /// <summary>
        /// 返回数据库列表
        /// </summary>
        /// <returns></returns>
        public List<string> GetDbList()
        {
            OracleDaoBase dao = new OracleDaoBase();
            return dao.GetDbList();
        }
    }
}
